**************************************************************
*** Replication code for "The 'Commitment trap' Revisited: ***
*** Experimental Evidence on Ambiguous Nuclear Threats" by ***
*** Michal Smetana, Marek Vranka, and Ondrej Rosendorf     ***
**************************************************************

*** The code was written in Stata 17.0 BE-Basic Edition ***

*** Please reach out to ondrej.rosendorf@fsv.cuni.cz if you have any questions concerning this replication file ***

*** IMPORTANT: This file is accompanied by the svr_jeps_replication_data4 dataset ***

*** Before proceeding with the replication, please make sure that the "coefplot", "catplot" and "asdoc" package is installed ***

*** To install the coefplot package, use the following command ***

ssc install coefplot, replace

*** To install the catplot package, use the following command ***

ssc install catplot, replace

*** To install the asdoc package, use the following command ***

ssc install asdoc, replace

*** Setting the output scheme to black and white ***

set scheme s1mono

*************************************************
*** Replication of the results in Appendix 13 ***
*************************************************

*** Appendix 13, Table 1 (contingency tables) - President over treatment ***

* Generating a labelled version of the scenario_n variable
recode scenario_n (0=0 "Control") (1=1 "Ambiguous threat") (2=2 "Explicit threat"), generate(scenario_n_label)

* Generating a labelled version of the president variable
recode president (1=1 "Trump") (2=2 "Biden") (3=3 "Republican") (4=4 "Democrat") (5=5 "Generic"), generate(president_label)

* Generating and exporting cross-tabs of president_label over scenario_n_label
asdoc tab scenario_n_label president_label, title(Table 1: Cross-tabulations of associations across treatments) row chi2 save(A13T01.rtf)

*** Appendix 13, Table 2 (contingency tables) - Trump over treatment ***

* Generating a simplified version of the president variable
gen trump = 0
replace trump = 1 if president == 1

* Generating a labelled version of the trump variable
recode trump (0=0 "Not Trump") (1=1 "Trump"), generate(trump_label)

* Generating a simplified version of the preference_ordinal variable
gen preference_adjusted = 0
replace preference_adjusted = 1 if preference_ordinal == 3
replace preference_adjusted = 1 if preference_ordinal == 4

* Generating a labelled version of the preference_adjusted variable
recode preference_adjusted (0=0 "Prefer conventional") (1=1 "Prefer nuclear"), generate(preference_adjusted_label)

* Generating cross-tabs for trump over preference by scenario
asdoc tab preference_adjusted_label trump_label if scenario_n_label==0, title(Table 2a: Cross-tabulations of response preference across associations - Control) col chi2 save(A13T02)
asdoc tab preference_adjusted_label trump_label if scenario_n_label==1, title(Table 2b: Cross-tabulations of response preference across associations - Ambiguity) col chi2 save(A13T02) 
asdoc tab preference_adjusted_label trump_label if scenario_n_label==2, title(Table 2c: Cross-tabulations of response preference across associations - Explicit) col chi2 save(A13T02)
asdoc tab preference_adjusted_label trump_label, title(Table 2d: Cross-tabulations of response preference across associations - Total) col chi2 save(A13T02)

*** Appendix 13, Table 3 (contingency tables) - President party over treatment ***

* Generating a simplified version of the president variable
gen president_party = .
replace president_party = 1 if president == 1
replace president_party = 1 if president == 3
replace president_party = 0 if president == 2
replace president_party = 0 if president == 4

* Generating a labelled version of the president_party variable
recode president_party (0=0 "Democrat") (1=1 "Republican"), generate(president_party_label)

* Generating cross-tabs for president_party over preference by scenario
asdoc tab preference_adjusted_label president_party_label if scenario_n_label==0, title(Table 3a: Cross-tabulations of response preference across associations - Control) col chi2 save(A13T03)
asdoc tab preference_adjusted_label president_party_label if scenario_n_label==1, title(Table 3b: Cross-tabulations of response preference across associations - Ambiguity) col chi2 save(A13T03)
asdoc tab preference_adjusted_label president_party_label if scenario_n_label==2, title(Table 3c: Cross-tabulations of response preference across associations - Explicit) col chi2 save(A13T03)
asdoc tab preference_adjusted_label president_party_label, title(Table 3d: Cross-tabulations of response preference across associations - Total) col chi2 save(A13T03)

*************************************************
*** Replication of the results in Appendix 14 ***
*************************************************

*** Appendix 14, Figure 1 (coefficient plot) - Preference (DV), no subset ***

* Running the ordinal logit model (Model 5)
ologit preference_ordinal i.scenario_n 

* Storing the estimates (Model 5)
estimates store M5

* Running the ordinal logit model with controls (Model 6)
ologit preference_ordinal i.scenario_n i.male c.age c.income i.education_bin i.party

* Storing the estimates (Model 6)
estimates store M6

* Generating the coefficient plot (Appendix 14, Figure 1)
coefplot M5, bylabel(Model 5) || M6, bylabel (Model 6) ||, xline(0) coeflabels(1.scenario_n = "{bf:Treatment (ambiguity – control)}" 2.scenario_n = "{bf:Treatment (explicit – control)}" 1.male = "Gender (male)" age = "Age" income = "Income" 1.education_bin = "Education (university degree)" 1.party = "Party (Democrat – Republican)" 2.party = "Party (Independent – Republican)")

* Exporting the coefficient plot (Appendix 14, Figure 1)
graph export A14F01.png

*** Appendix 14, Figure 2 (catplot) - Preference over treatment ***

* Generating a catplot for preference_adjusted over scenario_n_label
catplot preference_adjusted scenario_n_label, percent(scenario_n_label) ytitle ("Percent of Respondents by Preference", size(small)) intensity(75) asyvars stack blabel(bar, pos(center) format(%4.0f) size(small)) legend(rows(1) stack size(small) order(1 "Prefer conventional" 2 "Prefer nuclear") symplacement(center))

* Exporting the catplot (Appendix 14, Figure 2)
graph export A14F02.png

*************************************************
*** Replication of the results in Appendix 15 ***
*************************************************

**** Appendix 15, Figure 1 - Credibility of non-nuclear response (DV), no subset ***

* Running the ordinal logit model (Model 1)
ologit credibility_nonnuclear i.scenario_n

* Storing the estimates (Model 1)
estimates store M1

* Running the ordinal logit model with controls (Model 2)
ologit credibility_nonnuclear i.scenario_n i.male c.age c.income i.education_bin i.party

* Storing the estimates (Model 2)
estimates store M2

* Generating the coefficient plot (Appendix 15, Figure 1)
coefplot M1, bylabel(Model 1) || M2, bylabel (Model 2) ||, xline(0) coeflabels(1.scenario_n = "{bf:Treatment (ambiguity – control)}" 2.scenario_n = "{bf:Treatment (explicit – control)}" 1.male = "Gender (male)" age = "Age" income = "Income" 1.education_bin = "Education (university degree)" 1.party = "Party (Democrat – Republican)" 2.party = "Party (Independent – Republican)")

* Exporting the coefficient plot (Appendix 15, Figure 1)
graph export A15F01.png

*** Appendix 15, Figure 2 - Credibility of non-nuclear response across treatments ***

* Generating a simplified version of credibility_nonnuclear
gen credibility_nonnuclear_adjusted = 0
replace credibility_nonnuclear_adjusted = 1 if credibility_nonnuclear == 3
replace credibility_nonnuclear_adjusted = 2 if credibility_nonnuclear == 4
replace credibility_nonnuclear_adjusted = 2 if credibility_nonnuclear == 5

* Generating a catplot of credibility_nonnuclear_adjusted over scenario_n_label
catplot credibility_nonnuclear_adjusted scenario_n_label, percent (scenario_n_label) ytitle ("Percent of Respondents by Credibility", size(small)) intensity(75) asyvars stack blabel(bar, pos(center) format(%4.0f) size(small)) legend(rows(1) stack size(small) order(1 "Weaken credibility" 2 "Neither weaken nor bolster" 3 "Bolster credibility") symplacement(center))

* Exporting the catplot (Appendix 15, Figure 2)
graph export A15F02.png

****************************
*** End replication here ***
****************************